package com.lcb.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/****
 * @Author:刘长柏
 * @Date: 2021-01-19 14:39
 * @Description:resid主从搭建测试
 *****/
public class JedisSingleTest {
    public static void main(String[] args) {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        //最大线程数
        jedisPoolConfig.setMaxTotal(20);
        //空闲线程数
        jedisPoolConfig.setMaxIdle(10);
        //最小线程数
        jedisPoolConfig.setMinIdle(5);

        JedisPool jedisPool = new JedisPool(jedisPoolConfig, "192.168.91.116", 6379, 3000, null);
        Jedis jedis = null;

        jedis = jedisPool.getResource();
        System.out.println(jedis.set("lcb", "666"));
        System.out.println(jedis.get("lcb"));


    }
}
